﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace TMIS
{
    public partial class frmLogin : XtraForm
    {
        private BLL.Login bll = new BLL.Login();
        public frmLogin()
        {
            InitializeComponent();
        }
        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (bll.Check(txtName.Text,txtPassword.Text,comIdentity.Text))
            {
                XtraMessageBox.Show("用户登录成功");
                frmMain frm = new frmMain(bll.Get(txtName.Text,txtPassword.Text,comIdentity.Text),comIdentity.Text);
                this.Hide();
                frm.Show();
            }
            else
                XtraMessageBox.Show("用户登录失败，请检查！");
        }

        private void btnAddTeacher_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmTeacher frm = new frmTeacher();
            frm.TeacherView.Enabled = false;
            frm.ShowDialog();
        }

        private void btnRegStudent_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmRegStudent frm = new frmRegStudent();
            frm.ShowDialog();
        }
    }
}
